package com.neulogistics.contrib.usercenter.infrastructure.persistence.orm.po;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;

/**
 * 
 * @TableName tb_role
 */
@TableName(value ="tb_role", autoResultMap = true)
@Data
public class RolePO implements Serializable {
    /**
     * 角色id
     */
    @TableId(value = "role_id", type = IdType.AUTO)
    private Integer roleId;

    /**
     * 角色菜单
     */
    @TableField(value = "role_menu", typeHandler = JacksonTypeHandler.class)
    private JSONArray roleMenu;

    /**
     * 角色等级：0：管理员 1:客服中心 2:调度中心 3:中心库房  4: 分站库房 5: 分站 6: 配送中心 7:财务部 8:配送员
     */
    @TableField(value = "role_level")
    private Integer roleLevel;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        RolePO other = (RolePO) that;
        return (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()))
            && (this.getRoleMenu() == null ? other.getRoleMenu() == null : this.getRoleMenu().equals(other.getRoleMenu()))
            && (this.getRoleLevel() == null ? other.getRoleLevel() == null : this.getRoleLevel().equals(other.getRoleLevel()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
        result = prime * result + ((getRoleMenu() == null) ? 0 : getRoleMenu().hashCode());
        result = prime * result + ((getRoleLevel() == null) ? 0 : getRoleLevel().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", roleId=").append(roleId);
        sb.append(", roleMenu=").append(roleMenu);
        sb.append(", roleLevel=").append(roleLevel);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}